package org.springblade.modules.admin.vo;

import lombok.Data;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.admin.enums.MaintainPlanContentEnum;
import org.springblade.modules.admin.enums.TaskStatusEnum;

import java.util.Date;

/**
 * @Date 14:10 2025/4/10
 * @Description {
 *   整改工单分页展示
 * }
 * @Author lsay
 **/
@Data
public class PlanAbarbeitungPageVO {

	/**
	 * 工单id
	 */
	private Long planId;

	/**
	 * 电梯id
	 */
	private Long elevatorId;

	/**
	 * 项目id
	 */
	private Long buildingId;

	/**
	 * 电梯地址
	 */
	private String elevatorAddress;

	/**
	 * 项目名称
	 */
	private String buildingName;

	/**
	 * 创建人
	 */
	private String createUserName;

	/**
	 * 计划执行人
	 */
	private String planExecutorNames;

	/**
	 * 计划截止时间
	 */
	private Date planFinishDate;

	/**
	 * 计划逾期状态 1-未逾期 2-即将逾期 3-已逾期
	 */
	private Integer overdueType;

	/**
	 * 计划逾期状态名称
	 */
	private String overdueTypeName;

	/**
	 * 转派次数
	 */
	private Integer redeployCount;

	/**
	 * 转派人员名称
	 */
	private String redeployUserNames;

	/**
	 * 转派截止时间
	 */
	private Date redeployFinishDate;

	/**
	 * 转派逾期状态 1-未逾期 2-即将逾期 3-已逾期
	 */
	private Integer redeployOverdueStatus;

	/**
	 * 转派逾期状态名称
	 */
	private String redeployOverdueStatusName;

	/**
	 * 参与工单执行人
	 */
	private String planParticipationNames;

	/**
	 * 实际完成执行人
	 */
	private String planFinishUserNames;

	/**
	 * 创建时间
	 */
	private Date createTime;

	/**
	 * 开始时间
	 */
	private Date planBeginTime;

	/**
	 * 完成时间
	 */
	private Date planEndTime;

	/**
	 * 工作耗时（分钟）
	 */
	private Integer workMinute;

	/**
	 * 整改事项统计
	 */
	private Integer scoreIssue;

	/**
	 * 重新打开次数
	 */
	private Integer reopenCount;

	/**
	 * 紧急程度 1:非常紧急2:紧急3:普通4:较低
	 */
	private Integer emerProcType;

	/**
	 * 紧急程度名称
	 */
	private String emerProcTypeName;

	/**
	 * 工单状态
	 */
	private Integer planStatus;

	/**
	 * 工单状态名称
	 */
	private String planStatusName;

	/**
	 * 详情记录Id
	 */
	private Long detailId;

	/**
	 * 扩展表Id
	 */
	private Long extId;

	public void setOverdueType(Integer overdueType) {
		if(Func.isNotEmpty(overdueType)){
			if(overdueType.equals(1)){
				this.overdueTypeName = "未逾期";
			}else if (overdueType.equals(2)){
				this.overdueTypeName = "即将逾期";
			}else {
				this.overdueTypeName = "已逾期";
			}
		}
		this.overdueType = overdueType;
	}

	public void setRedeployOverdueStatus(Integer redeployOverdueStatus) {
		if(Func.isNotEmpty(redeployOverdueStatus)){
			if(redeployOverdueStatus.equals(1)){
				this.redeployOverdueStatusName = "未逾期";
			}else if (redeployOverdueStatus.equals(2)){
				this.redeployOverdueStatusName = "即将逾期";
			}else {
				this.redeployOverdueStatusName = "已逾期";
			}
		}
		this.redeployOverdueStatus = redeployOverdueStatus;
	}

	public void setPlanStatus(Integer planStatus) {
		if(Func.isNotEmpty(planStatus)){
			this.planStatusName = TaskStatusEnum.getTaskName(MaintainPlanContentEnum.ABARBEITUNG.getId(),planStatus);
		}
		this.planStatus = planStatus;
	}

	public void setEmerProcType(Integer emerProcType) {
		if(Func.isNotEmpty(emerProcType)){
			if(emerProcType.equals(1)){
				this.emerProcTypeName = "非常紧急";
			}else if (emerProcType.equals(2)){
				this.emerProcTypeName = "紧急";
			}else if (emerProcType.equals(3)){
				this.emerProcTypeName = "普通";
			}else {
				this.emerProcTypeName = "较低";
			}
		}
		this.emerProcType = emerProcType;
	}
}
